package com.gnerv.sylvanas.business.manage.operation;

import com.gnerv.sylvanas.framework.core.BaseCurrentAccount;
import com.gnerv.sylvanas.business.manage.model.bo.ConfigBO;
import com.gnerv.sylvanas.business.manage.model.dto.ConfigDTO;
import com.gnerv.sylvanas.business.manage.model.entity.Config;
import com.gnerv.sylvanas.business.manage.storage.ConfigStorageService;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Gnerv LiGen
 */
@Service
@AllArgsConstructor
public class ConfigOperationService {

    private final ConfigStorageService configStorageService;
    private final BaseCurrentAccount baseCurrentAccount;

    
    public boolean create(@NonNull ConfigBO configBO) {
        Config config = configBO.toConfig();
        
        configStorageService.insert(config);
        return true;
    }

    
    public boolean deleteByUkId(@NonNull String ukId) {
        configStorageService.deleteByUkId(ukId);
        return true;
    }

    
    public boolean updateByUkId(@NonNull ConfigBO configBO) {
        Config config = configBO.toConfig();
        configStorageService.updateByUkId(config);
        return true;
    }

    
    public ConfigDTO selectByUkId(@NonNull String ukId) {
        return configStorageService.selectByUkId(ukId);
    }

    
    public List<ConfigDTO> selectListByName(String name) {
        return configStorageService.selectListByName(name);
    }

}




